import { IFeidaoAiNodejsComponent } from '@dfeidao/atom-nodejs/interfaces';
import nodejs from '@dfeidao/atom-nodejs/msg/nodejs';
import render from '@dfeidao/atom-nodejs/render/render';
import p001 from './p001';
import p002 from './p002';
import p003 from './p003';
export default async function na001(fd: IFeidaoAiNodejsComponent) {
	// todo
	// const pn = a.page_no || 1;
	const res = await nodejs(fd.data.actionid, fd.data.sessionid, 'device-management-ygh/zj-000002/s001', {
		page: {
			value1: '',
			value2: '',
			value3: '',
			page_no: 1
		}
	});
	console.log(res);
	const res1 = await nodejs<{ res: Array<{}> }>(fd.data.actionid, fd.data.sessionid, 'device-management-ygh/zj-000002/s002', {});
	console.log(res1.res);
	const res2 = await nodejs<{ res: Array<{}> }>(fd.data.actionid, fd.data.sessionid, 'device-management-ygh/zj-000002/s003', {});
	console.log(res2);
	render(fd.data.node, res, p001, 'p001');
	render(fd.data.node, res1.res[0], p002, 'p002');

	const t = '固定资产类型';
	const title = await nodejs<Array<{ value_no: string }>>(fd.data.actionid, fd.data.sessionid, 'device-management-ygh/zj-000002/s004', { value_title: t });
	const no = title[0].value_no;
	const type = await nodejs<{ data: Array<{}> }>(fd.data.actionid, fd.data.sessionid, 'device-management-ygh/zj-000002/s005', { value_no: no });
	// console.log(type);
	render(fd.data.node, type.data[0], p003, 'p003');
}
